package com.liesheng.haylou.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.liesheng.haylou.R;

/**
 * Date:${DATA}
 * Author ${ZhangZhiQiang}
 * Description
 */
public class DialogWheelView extends Dialog implements View.OnClickListener {
    private String mMessage = "";

    public DialogWheelView(@NonNull Context context) {
        super(context);
    }
    public DialogWheelView(@NonNull Context context, String message) {
        super(context, R.style.MyDialogStyle);
        mMessage = message;
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_check);

        findViewById(R.id.wheelview).setOnClickListener(this);

        if(!TextUtils.isEmpty(mMessage)) {
            TextView textView = findViewById(R.id.wheelview);
            textView.setText(mMessage);
        }

        setCancelable(true);
        setCanceledOnTouchOutside(true);
    }

    @Override
    public void onClick(View v) {
        if(v.getId() == R.id.wheelview){
            dismiss();
            if(mListener != null){
                mListener.onClickYes();
            }
        }

    }
    private OnDialogClickListener mListener = null;

    public void setOnDialogClickListener(OnDialogClickListener listener){
        mListener = listener;
    }

    public interface OnDialogClickListener {
        void onClickYes();
        void onClickNo();
    }
}
